// ******************************************************************************
// Copyright     :  Copyright (C) 2020, Hisilicon Technologies Co. Ltd.
// File name     :  cnb_c_union_define.h
// Project line  :  Platform And Key Technologies Development
// Department    :  CAD Development Department
// Author        :  xxx
// Version       :  1.0
// Date          :  2013/3/10
// Description   :  The description of xxx project
// Others        :  Generated automatically by nManager V5.1
// History       :  xxx 2020/10/23 11:25:21 Create file
// ******************************************************************************

#ifndef CNB_C_UNION_DEFINE_H
#define CNB_C_UNION_DEFINE_H

/* Define the union csr_cnb_version_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 cnb_version : 32; /* [31:0] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_version_u;

/* Define the union csr_cnb_tmout_cnt_thd_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 rp_tmout_cnt_thd : 32; /* [31:0] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_tmout_cnt_thd_u;

/* Define the union csr_cnb_empty_addr_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 api_err_addr : 26; /* [25:0] */
        u32 rsv_0 : 6;         /* [31:26] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_empty_addr_u;

/* Define the union csr_cnb_api_err_flit_cnt_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 cnb_api_err_flit_cnt : 32; /* [31:0] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_api_err_flit_cnt_u;

/* Define the union csr_cnb_api_crt_msge_cnt_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 cnb_api_crt_msge_cnt : 32; /* [31:0] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_api_crt_msge_cnt_u;

/* Define the union csr_cnb_api_tx_msge_cnt_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 cnb_api_tx_msge_cnt : 32; /* [31:0] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_api_tx_msge_cnt_u;

/* Define the union csr_cnb_int_vector_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 cpi_int_index : 24; /* [23:0] */
        u32 rsv_1 : 3;          /* [26:24] */
        u32 enable : 1;         /* [27] */
        u32 int_issue : 1;      /* [28] */
        u32 rsv_2 : 3;          /* [31:29] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_int_vector_u;

/* Define the union csr_cnb_int_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 int_data : 6;           /* [5:0] */
        u32 rsv_3 : 10;             /* [15:6] */
        u32 program_csr_id_ro : 16; /* [31:16] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_int_u;

/* Define the union csr_cnb_int_en_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 int_en : 6;          /* [5:0] */
        u32 rsv_4 : 10;          /* [15:6] */
        u32 program_csr_id : 16; /* [31:16] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_int_en_u;

/* Define the union csr_cnb_api_op_code_err_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 opcode_err : 1;       /* [0] */
        u32 opcode_err_insrt : 1; /* [1] */
        u32 opcode_err_info : 30; /* [31:2] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_api_op_code_err_u;

/* Define the union csr_cnb_csr_cmd_parity_err_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 cmdpar_err : 1;       /* [0] */
        u32 cmdpar_err_insrt : 1; /* [1] */
        u32 cmdpar_err_info : 30; /* [31:2] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_csr_cmd_parity_err_u;

/* Define the union csr_cnb_csr_wr_err_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 wrcmd_err : 1;       /* [0] */
        u32 wrcmd_err_insrt : 1; /* [1] */
        u32 wrcmd_err_info : 30; /* [31:2] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_csr_wr_err_u;

/* Define the union csr_cnb_csr_rddat_parity_err_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 rdatpar_err : 1;       /* [0] */
        u32 rdatpar_err_insrt : 1; /* [1] */
        u32 rdatpar_err_info : 30; /* [31:2] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_csr_rddat_parity_err_u;

/* Define the union csr_cnb_csr_rd_err_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 rdcmd_err : 1;       /* [0] */
        u32 rdcmd_err_insrt : 1; /* [1] */
        u32 rdcmd_err_info : 30; /* [31:2] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_csr_rd_err_u;

/* Define the union csr_cnb_merr_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 tmout_err : 1;           /* [0] */
        u32 tmout_err_insrt : 1;     /* [1] */
        u32 intpar_err : 1;          /* [2] */
        u32 intpar_err_insrt : 1;    /* [3] */
        u32 api_e1_err : 1;          /* [4] */
        u32 api_e1_err_insrt : 1;    /* [5] */
        u32 api_e0_err : 1;          /* [6] */
        u32 api_e0_err_insrt : 1;    /* [7] */
        u32 api_token_err : 1;       /* [8] */
        u32 api_token_err_insrt : 1; /* [9] */
        u32 api_prot_err : 1;        /* [10] */
        u32 api_prot_err_insrt : 1;  /* [11] */
        u32 rsv_5 : 20;              /* [31:12] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_merr_u;

/* Define the union csr_cnb_merr_en_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 tmout_err_en : 1;     /* [0] */
        u32 intpar_err_en : 1;    /* [1] */
        u32 api_e1_err_en : 1;    /* [2] */
        u32 api_e0_err_en : 1;    /* [3] */
        u32 api_token_err_en : 1; /* [4] */
        u32 api_prot_err_en : 1;  /* [5] */
        u32 rsv_6 : 26;           /* [31:6] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_cnb_merr_en_u;

/* Define the union csr_rs_nd_pe_crdt_u */
typedef union {
    /* Define the struct bits */
    struct {
        u32 crdt_sta : 10; /* [9:0] */
        u32 rsv_7 : 22;    /* [31:10] */
    } bits;

    /* Define an unsigned member */
    u32 value;
} csr_rs_nd_pe_crdt_u;


// ==============================================================================
/* Define the global struct */
typedef struct {
    volatile csr_cnb_version_u cnb_version;                           /* 0 */
    volatile csr_cnb_tmout_cnt_thd_u cnb_tmout_cnt_thd;               /* 4 */
    volatile csr_cnb_empty_addr_u cnb_empty_addr;                     /* 8 */
    volatile csr_cnb_api_err_flit_cnt_u cnb_api_err_flit_cnt;         /* C */
    volatile csr_cnb_api_crt_msge_cnt_u cnb_api_crt_msge_cnt;         /* 10 */
    volatile csr_cnb_api_tx_msge_cnt_u cnb_api_tx_msge_cnt;           /* 14 */
    volatile csr_cnb_int_vector_u cnb_int_vector;                     /* 18 */
    volatile csr_cnb_int_u cnb_int;                                   /* 1C */
    volatile csr_cnb_int_en_u cnb_int_en;                             /* 20 */
    volatile csr_cnb_api_op_code_err_u cnb_api_op_code_err;           /* 24 */
    volatile csr_cnb_csr_cmd_parity_err_u cnb_csr_cmd_parity_err;     /* 28 */
    volatile csr_cnb_csr_wr_err_u cnb_csr_wr_err;                     /* 2C */
    volatile csr_cnb_csr_rddat_parity_err_u cnb_csr_rddat_parity_err; /* 30 */
    volatile csr_cnb_csr_rd_err_u cnb_csr_rd_err;                     /* 34 */
    volatile csr_cnb_merr_u cnb_merr;                                 /* 38 */
    volatile csr_cnb_merr_en_u cnb_merr_en;                           /* 3C */
    volatile csr_rs_nd_pe_crdt_u rs_nd_pe_crdt;                       /* 40 */
} S_cnb_csr_REGS_TYPE;

/* Declare the struct pointor of the module cnb_csr */
extern volatile S_cnb_csr_REGS_TYPE *gopcnb_csrAllReg;

/* Declare the functions that set the member value */
int iSetCNB_VERSION_cnb_version(unsigned int ucnb_version);
int iSetCNB_TMOUT_CNT_THD_rp_tmout_cnt_thd(unsigned int urp_tmout_cnt_thd);
int iSetCNB_EMPTY_ADDR_api_err_addr(unsigned int uapi_err_addr);
int iSetCNB_API_ERR_FLIT_CNT_cnb_api_err_flit_cnt(unsigned int ucnb_api_err_flit_cnt);
int iSetCNB_API_CRT_MSGE_CNT_cnb_api_crt_msge_cnt(unsigned int ucnb_api_crt_msge_cnt);
int iSetCNB_API_TX_MSGE_CNT_cnb_api_tx_msge_cnt(unsigned int ucnb_api_tx_msge_cnt);
int iSetCNB_INT_VECTOR_cpi_int_index(unsigned int ucpi_int_index);
int iSetCNB_INT_VECTOR_enable(unsigned int uenable);
int iSetCNB_INT_VECTOR_int_issue(unsigned int uint_issue);
int iSetCNB_INT_int_data(unsigned int uint_data);
int iSetCNB_INT_program_csr_id_ro(unsigned int uprogram_csr_id_ro);
int iSetCNB_INT_EN_int_en(unsigned int uint_en);
int iSetCNB_INT_EN_program_csr_id(unsigned int uprogram_csr_id);
int iSetCNB_API_OP_CODE_ERR_opcode_err(unsigned int uopcode_err);
int iSetCNB_API_OP_CODE_ERR_opcode_err_insrt(unsigned int uopcode_err_insrt);
int iSetCNB_API_OP_CODE_ERR_opcode_err_info(unsigned int uopcode_err_info);
int iSetCNB_CSR_CMD_PARITY_ERR_cmdpar_err(unsigned int ucmdpar_err);
int iSetCNB_CSR_CMD_PARITY_ERR_cmdpar_err_insrt(unsigned int ucmdpar_err_insrt);
int iSetCNB_CSR_CMD_PARITY_ERR_cmdpar_err_info(unsigned int ucmdpar_err_info);
int iSetCNB_CSR_WR_ERR_wrcmd_err(unsigned int uwrcmd_err);
int iSetCNB_CSR_WR_ERR_wrcmd_err_insrt(unsigned int uwrcmd_err_insrt);
int iSetCNB_CSR_WR_ERR_wrcmd_err_info(unsigned int uwrcmd_err_info);
int iSetCNB_CSR_RDDAT_PARITY_ERR_rdatpar_err(unsigned int urdatpar_err);
int iSetCNB_CSR_RDDAT_PARITY_ERR_rdatpar_err_insrt(unsigned int urdatpar_err_insrt);
int iSetCNB_CSR_RDDAT_PARITY_ERR_rdatpar_err_info(unsigned int urdatpar_err_info);
int iSetCNB_CSR_RD_ERR_rdcmd_err(unsigned int urdcmd_err);
int iSetCNB_CSR_RD_ERR_rdcmd_err_insrt(unsigned int urdcmd_err_insrt);
int iSetCNB_CSR_RD_ERR_rdcmd_err_info(unsigned int urdcmd_err_info);
int iSetCNB_MERR_tmout_err(unsigned int utmout_err);
int iSetCNB_MERR_tmout_err_insrt(unsigned int utmout_err_insrt);
int iSetCNB_MERR_intpar_err(unsigned int uintpar_err);
int iSetCNB_MERR_intpar_err_insrt(unsigned int uintpar_err_insrt);
int iSetCNB_MERR_api_e1_err(unsigned int uapi_e1_err);
int iSetCNB_MERR_api_e1_err_insrt(unsigned int uapi_e1_err_insrt);
int iSetCNB_MERR_api_e0_err(unsigned int uapi_e0_err);
int iSetCNB_MERR_api_e0_err_insrt(unsigned int uapi_e0_err_insrt);
int iSetCNB_MERR_api_token_err(unsigned int uapi_token_err);
int iSetCNB_MERR_api_token_err_insrt(unsigned int uapi_token_err_insrt);
int iSetCNB_MERR_api_prot_err(unsigned int uapi_prot_err);
int iSetCNB_MERR_api_prot_err_insrt(unsigned int uapi_prot_err_insrt);
int iSetCNB_MERR_EN_tmout_err_en(unsigned int utmout_err_en);
int iSetCNB_MERR_EN_intpar_err_en(unsigned int uintpar_err_en);
int iSetCNB_MERR_EN_api_e1_err_en(unsigned int uapi_e1_err_en);
int iSetCNB_MERR_EN_api_e0_err_en(unsigned int uapi_e0_err_en);
int iSetCNB_MERR_EN_api_token_err_en(unsigned int uapi_token_err_en);
int iSetCNB_MERR_EN_api_prot_err_en(unsigned int uapi_prot_err_en);
int iSetRS_ND_PE_CRDT_crdt_sta(unsigned int ucrdt_sta);


#endif // CNB_C_UNION_DEFINE_H
